/**
 * create by young (young2f@outlook.com) on 2020/9/12
 */
'use strict';
import React, {Component} from 'react';
import {Button, Form} from 'antd';
import moment from 'moment';
import 'moment/locale/zh-cn';
import {ModalFooter} from 'antd-extra';

const _ = require('lodash');
moment.locale('zh-cn');

@Form.create()
//@connect(({ workOrder, global }) => ({ ...workOrder, ...global }))
export default class ModalConfirm extends Component {
  constructor(props) {
    super(props);

  }

  componentDidMount() {

  }

  renderFoot = () => {
    const { foot, value, modalRef } = this.props;
    if (foot) {
      return foot(value, modalRef);
    } else {
      return (
        <ModalFooter>
          <Button type="primary" onClick={() => {
            const { result } = this.props;
            result && result('yes');
            modalRef.close();
          }}>确定</Button>
          <Button onClick={() => {
            modalRef.close();
          }}>取消</Button>
        </ModalFooter>
      );
    }
  };

  render() {
    const { message } = this.props;
    return (<div>
      <div>
        {message}
      </div>
      {this.renderFoot()}
    </div>);
  }

}
